home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 36
/
Amiga Format CD36 (1999-01-22)(Future Publishing)(GB)[!][issue 1999-02].iso
/
-seriously_amiga-
/
comms
/
other
/
makeftpscript
/
arexx
/
makeftpscript.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1998-11-30
|
2KB
|
85 lines
/* MakeFTPScript v1.4 by Grzegorz Fitrzyk SP9WUN (sp9wun@sr9zaa.ampr.org)
usage: rx rexx:MakeFTPScript.rexx ADDRESS/K SOURCE/K DEST/K README/S
ex.: rx rexx:MakeFTPScript.rexx ftp.wustl.edu ram:recent ram:script readme
*/
parse arg ADDRESS source destin readflag
parse var readflag ' ' readfl
MODE=''
total=0
readfl=upper(readfl)
destindx=destin||'.idx'
options results
if Open(loadit, source, 'Read') then do /* Open source file.*/
if Open(Saveit, destin, 'Write') then do /* Open destination file. */
if Open(Saveind, destindx, 'Write') then do /* Open index file. */
do forever
line=Readln(loadit)
if line="" then leave
parse var line '|'. header
if header="" then do
if line~="|" then do
call makeline
end
end
end
end; else call error_write
end; else call error_write
end; else call error_read
say 'Total size of requested files 'total'KB'
say 'Conversion succesfull.'
quitit:
call close(saveit)
call close(loadit)
call close(saveind)
address command 'c:filenote 'destin' 'total'KB'
exit
error_read:
say 'Cant find source file: 'source
call quitit
error_write:
say 'Cant write destination file 'dest
call quitit
makeline:
parse var line filename direct size rest
tt2=pos('+',size)
size2=size
if tt2~=0 then parse var size2 size '+'
linecom='ncftp'||MODE||' '||ADDRESS||':'||'pub/aminet/'||direct||'/'||filename
call writeln(saveit,linecom)
exten=right(size,1)
if exten='?' then size='0K'
temp=length(size)
size=left(size,temp-1)
size=translate(size,,' ')
if exten="M" then size=size*1024
total=total+size
call doindex
if readfl="README" then call doreadme
return
doreadme:
dlug=length(filename)
readname=left(filename,dlug-3)
linecom='ncftp'||MODE||' '||ADDRESS||':'||'pub/aminet/'||direct||'/'||readname||'readme'
call writeln(saveit,linecom)
size=0
filename=readname||'readme'
call doindex
return
doindex:
size=translate(size,,' ')
indout=filename||' '||size
call writeln(saveind,indout)
return